const API_URL = "http://127.0.0.1:8080/";
const VDISK_PATH_PRE = "/disk/";
const API_PATH_PRE = "/api/";
const STATIC_URL = "/api/static/"
const MAX_UPLOAD_SIZE = { size: 100 * 1024 * 1024, format: "100M"}  // 100M
const DIR_OBJECT = { icon: "folder", color: "#ffbc31", openIcon: "folder-open", theme: "filled"};
const FILE_OBJECT = { icon: "file-text", color: "#3c3c3c", theme: "filled"};
const DEFAULT_USER_PASSWORD = 'cdms123456!'
const HTTP_STATUS = {
    400: "请求异常",
    403: "无访问权限",
    404: "页面不存在",
    405: "方法禁用",
    406: "无法接受",
    409: "已存在",
    500: "服务器内部错误",
};
const COL_SPAN = { xs: 12, sm: 8, md: 4, lg: 3, xl: 2 };
const LIST_ITEMS = 10;
const DOWNLOAD_TYPES = [
    { name: "原文件", icon: "file-text", type_value: 3},
    { name: "PDF文件", icon: "file-text", type_value: 1},
    // { name: "只读文件", icon: "file-text", type_value: 1},
    { name: "水印文件", icon: "file-text", type_value: 3},
    // { name: "加密文件", icon: "file-text", type_value: 1},
];
const XS_SIZE = 576;
// const DAY_MILLISECONDS = 86400000;

const fileType = {
    true: {
        text: '目录',
    },
    false: {
        text: '文件',
    },
}
const PARAM_FIELDS = [  // 字段的所有属性
    { key: "name", name: "名称", sorter: true, valueEnum: {},},  // forever: 一直都显示 | 永恒
    { key: "size", name: "大小", sorter: true, valueEnum: {}, },
    { key: "owner", name: "所有者", sorter: false, valueEnum: {}, },
    { key: "modified", name: "修改时间", sorter: true, valueEnum: {}, valueType: 'dateTime', },
    { key: "option", name: "操作", },
];

const FILE_FIELDS = {
    name: { key: 0, name: "名称", sorter: true, },
    size: { key: 1, name: "大小", sorter: true, },
    modified: { key: 2, name: "修改时间", sorter: true, },
    owner: { key: 3, name: "所有者", sorter: false,},
    option: { key: 4, name: "操作", sorter: false,},
};

const PARAMS_MAP = {
    avatar: "avatar",
    id: "userid",  // 用户唯一id | int | required
    username: "name",  // 账号名 | string | required
    trueName: "trueName",  // 真实名称 | string
    nickName: "nickName",  // 昵称 | string
    email: "email",  // 邮箱 | string
    enable: "enable",  // 是否启用该账号 | bool
    groups: "groups",  // 组 | []
    homeDisk: "homeDisk",   // 对应磁盘名 | string
    isSuper: "super",  // 超级用户 | bool
    isSys: "sys",  // 系统用户 | bool
    mobile: "phone",  // 手机号 | string
    tel: "tel",  // 座机、电话 | string
    cl: "cl",  // 密级 | int
    perm: "perm",  // 权限码 | int64
    createdAt: "created",  // 创建时间 | string | 可用new Date(created) 转换为Date型的字符串
}

const TRASH_MAP = {
    userID: 'userid',
    isDir: "isDir",
    diskID: "vdiskName",
    orgPath: 'orgPath',
    removeAt: 'removed',
};

// 文件转化类型
const TRANS_TYPE = [
    { type: "ORG", name: "原始文件", icon: "file-text" },
    { type: "PDF", name: "PDF文件", icon: "file-pdf" },
    { type: "READ", name: "只读文件", icon: "eye" },
    { type: "MARK", name: "水印文件", icon: "audit" },
    { type: "PWD", name: "加密文件", icon: "file-protect" },
]

// optionsHeader 配置
const HEADER_OPTS = {
    trash: [
        { isGroup: false, icon: 'rest', text: '清空', type: 'danger', className: 'headerBtns', action: 'trash/deleteTrash' },
        {
            isGroup: true, className:'headerBtns', groups: [
                { icon: 'delete', text: '删除', type: '', action:'' },
                { icon: 'redo', text: '恢复', type: '', action: '' },
            ]
        },
    ],
    pubPri:[],
}

//
const MOULD_MARK = {
    Account: 'account',
    Group: 'group',
    Vdisk: 'vdisk',
    Folder: 'folder',
}

const PATH_SEPARATOR = "\\"; // 根据平台片段路径的 分隔符

const BASE_HEADERS = {
    'Authorization': `Bearer ${localStorage.getItem("token")}`,
}

//usr
const PATH_LENGTH = 2;  // 返回上一层需要省略的路径长度

const VDISK_NAME = localStorage.getItem("authority");

const TEST_USER = 'jieTan'

export { 
    API_URL, VDISK_PATH_PRE, API_PATH_PRE, STATIC_URL,
    MAX_UPLOAD_SIZE,
    DIR_OBJECT, FILE_OBJECT,
    DEFAULT_USER_PASSWORD,
    HTTP_STATUS,
    COL_SPAN,
    LIST_ITEMS,
    DOWNLOAD_TYPES,
    XS_SIZE,
    // DAY_MILLISECONDS,
    PARAM_FIELDS, FILE_FIELDS,
    PARAMS_MAP, TRASH_MAP, TRANS_TYPE, HEADER_OPTS,
    MOULD_MARK,
    PATH_SEPARATOR,
    BASE_HEADERS,
    PATH_LENGTH,
    VDISK_NAME,
    TEST_USER,
 };